import { DatabaseService } from './db';
import express from 'express';
import cors from 'cors';
import { getApiRouter } from './router';
import * as ENV_CONFIG from "./config.json";
import { ApolloServers } from './apollo';

(async () => {
  await DatabaseService.init();
  await ApolloServers.init();
  const app = express();

  app.use(cors());
  app.use(express.json());



  app.use("/api", getApiRouter());

  app.listen(ENV_CONFIG.port, () => {
    console.log(`🚀 Server is running on port: ${ENV_CONFIG.port}`);
  });
})();